class AddArtistJoins < ActiveRecord::Migration
  def self.up
    create_table :artists_releases, :id => false do |t|
      t.integer :artist_id, :null => false
      t.integer :release_id, :null => false
    end

    create_table :artists_songs, :id => false do |t|
      t.integer :artist_id, :null => false
      t.integer :song_id, :null => false
    end

    #Foreign key definations
    add_foreign_key(:artists_releases, :artists, :column => :artist_id)
    add_foreign_key(:artists_releases, :releases, :column => :release_id)
    add_foreign_key(:artists_songs, :songs, :column => :song_id)
    add_foreign_key(:artists_songs, :artists, :column => :artist_id)
  end

  def self.down
    drop_table :artists_releases
    drop_table :artists_songs
  end
end
